<?php
include_once("../includes/global.php");
$script_tmp = explode('/', $_SERVER['SCRIPT_NAME']);
$sctiptName = array_pop($script_tmp);
include_once("auth.php");
//================
if(!empty($_POST["name"])&&empty($_POST["edit"]))
{
	if(empty($_POST['id']))
		$_POST['id']=0;
	$sql="insert into ".CTYPE."
	 (pid,company_type,name,con) 
	 values 
	 ('$_POST[id]','$_POST[company_type]','$_POST[name]','$_POST[con]')";
	 $db->query($sql);
	 msg("comments_list.php");
}
//================
if(!empty($_POST["id"])&&!empty($_POST["edit"]))
{
	$sql="update ".CTYPE." set name='$_POST[name]',con='$_POST[con]' where id='$_POST[id]'";
	$re=$db->query($sql);
	if($re)
		msg("comments_list.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<TITLE><?php echo lang_show('admin_system');?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form method="post" action="comments.php">
<div class="bigbox">
	<div class="bigboxhead"><?php echo lang_show('optinmang');?></div>
	<div class="bigboxbody">
	<table width="100%" cellspacing="0" cellpadding="0" align="center">
	 <?php
	 @include_once('config/module_company_config.php');
	 if(empty($_GET["sub"])&&empty($_GET["name"])&&!empty($module_company_config['identity']))
	 {
	 $identity=explode('|',$module_company_config['identity']);
	 ?>
	 <tr > 
		  <td width="22%" height="24" align="right" class="hh"><?php echo lang_show('companytype');?></td>
	      <td class="hh">
		    <select name="company_type" id="company_type">
				<?php
				foreach($identity as $v)
				{
				?>
			  	<option value="<?php echo $v?>" <?php if(!empty($_GET['ctype'])&&$v==$_GET['ctype']) echo "selected"; ?>><?php echo $v?></option>
				<?php
				}
				?>
		  </select><span class="bz"><?php echo lang_show('typemsg');?></span></td>
        </tr>
	  <?php } ?>
	  <tr >
	    <td height="24" align="right" class="hh"><?php echo lang_show('markoption');?></td>
	    <td class="hh">
		<input name="name" type="text" id="name" value="<?php echo empty($_GET["name"])?NULL:urldecode($_GET["name"])?>">
		<span class="bz"><?php echo lang_show('optionname');?></span></td>
	    </tr>
	  <tr >
	    <td height="24" align="right" class="hh"><?php echo lang_show('optionnote');?></td>
	    <td class="hh"><input name="con" type="text" id="con" value="<?php echo urldecode(!empty($_GET["con"])?$_GET["con"]:NULL)?>">	      <span class="bz"><?php echo lang_show('optionnote');?></span></td>
	    </tr>
	  <tr >
	    <td height="76" class="hh">&nbsp;</td>
        <td valign="top" class="hh"><input name="" class="btn" type="submit" value="<?php echo lang_show('subm');?>">
          <a style="text-decoration:none;" href="#" class="lbAction btn" rel="deactivate"><?php echo lang_show('cancel');?></a>	
          <input name="id" type="hidden" id="id" value="<?php echo !empty($_GET["id"])?$_GET["id"]:NULL?>">
          <input name="edit" type="hidden" id="edit" value="<?php echo !empty($_GET["edit"])?$_GET["edit"]:NULL?>">          </td>
	    </tr>
	</table>
</div>
</div>
</form> 
</body>
</HTML>